<div class="submit-form">
    <table class="submit-table">
        <tr>
            <td class="label">菜单名称：</td>
            <td><input name="id" type="hidden">
                <input name="name" class="easyui-textbox" data-options="required:true">
            </td>
        </tr>
        <tr>
            <td class="label">图标（icon）：</td>
            <td><input name="icon" class="easyui-textbox" data-options="required:false"></td>
        </tr>
        <tr>
            <td class="label">请求地址（url）：</td>
            <td><input name="url" class="easyui-textbox" style="height:50px;" data-options="required:true,multiline:true"></td>
        </tr>
        <tr>
            <td class="label">排序：</td>
            <td><input name="sort" class="easyui-numberbox" data-options="required:false"></td>
        </tr>
        <tr>
            <td class="label">备注：</td>
            <td><input name="remark" class="easyui-textbox" style="height:50px;"
                       data-options="required:false,multiline:true"></td>
        </tr>
    </table>
</div>

<script>
    $(function () {
        $('#name').combobox({
            prompt: '输入关键字搜索',
            required: true,
            editable: true,
            hasDownArrow: false,
            mode: 'remote',
            valueField: 'name',
            url: Api.User.VIEW_MENU + '/search_all_by_name',
            onBeforeLoad: function (param) {
                if (param && param.q) {
                    var value = param.q.replace('/ /g', '');
                    if (value !== '') {
                        return true;
                    }
                }
                return false;
            },
            onSelect: function (row) {
                if (row) {
                    $('#icon').textbox('setValue', row.icon);
                    $('#url').textbox('setValue', row.url);
                    $('#sort').numberbox('setValue', row.sort);
                    $('#remark').textbox('setValue', row.remark);
                }
            }
        });
    });
</script>